<template>
  <div class="header">
    <span @click="leftBtn">{{ leftText }}</span>
    <span> {{ title }}</span>
    <span @click="rightChange">{{ rightText }}</span>
  </div>
</template>

<script>
export default {
  props: {
    leftText: {
      type: String, // 要穿过来的字段
      required: false, // 该数据不是必须要传递的
      default: "",
    },
    rightText: {
      type: String, // 规定要传过来什么字段
      required: false, // 该数据不是必须要传递的
      default: "",
    },
    title: String,
  },
  setup(props, { emit }) {
    function rightChange() {
      emit("rightClick");
    }
    function leftBtn() {
      emit("leftBtn");
    }
    return {
      rightChange,
      leftBtn,
    };
  },
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 40px;
  background-color: orange;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
</style>
